home *** CD-ROM | disk | FTP | other *** search
/ Collection of Tools & Utilities / Collection of Tools and Utilities.iso / edit / pt20pc.zip / BIOS.C < prev    next >
Text File  |  1991-02-04  |  1KB  |  60 lines

  1. void pascal
  2. /* XTAG:setCPos */
  3. setCPos(row, col)
  4.     int row, col;
  5. {
  6.     rin.h.ah = 2;    /* set cursor position */
  7.     rin.h.bh = 0;    /* page number */
  8.     rin.h.dh = (char)row;
  9.     rin.h.dl = (char)col;
  10.     int86(0x10, &rin, &rout);
  11. }
  12.  
  13. void pascal
  14. /* XTAG:getCPos */
  15. getCPos(row, col)
  16.     int *row, *col;
  17. {
  18.     rin.h.ah = 3;    /* read cursor position */
  19.     rin.h.bh = 0;    /* page number */
  20.     int86(0x10, &rin, &rout);
  21.     *row = (int)rout.h.dh;
  22.     *col = (int)rout.h.dl;
  23. }
  24.  
  25. void pascal
  26. /* XTAG:putCharToScreen */
  27. putCharToScreen(ch, attribute, row, col)
  28.     char ch;
  29.     int ch, attribute, row, col;
  30. {
  31.     /* first move the cursor to the correct position */
  32.     rin.h.ah = 2;    /* set cursor position */
  33.     rin.h.bh = 0;    /* page number -- seems to be necessary */
  34.     rin.h.dh = (char)row;
  35.     rin.h.dl = (char)col;
  36.     int86(0x10, &rin, &rout);
  37.     /* now write it */
  38.     rin.h.ah = 9;    /* code for write character to screen */
  39.     rin.h.al = ch;
  40.     rin.h.bl = attribute;
  41.     rin.x.cx = dupCount;
  42.     int86(0x10, &rin, &rout);
  43. }
  44.  
  45. /* 0xB000 for a monochrome adapted, 0xB800 for a color or EGA adapter)
  46. #define DisplayMemoryBase 0xB800
  47.  
  48. void pascal
  49. /* XTAG:putCharToScreenFaster */
  50. putCharToScreenFaster(ch, attribute, row, col)
  51.     char ch;
  52.     int ch, attribute, row, col;
  53. {
  54.     /* generate the address in the memory buffer */
  55.     /* each row has 80 char/attribute byte pairs = 160 bytes */
  56.     char far *fp = DisplayMemoryBase + (160 * row) + col;
  57.     
  58.     *fp = ch;
  59. }
  60.